//
//  WebData.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/2.
//

import Foundation


struct Jump : Hashable {
    let id = UUID().uuidString
    let type : JumpType
    let json: String?
    
    init(type: JumpType) {
        self.type = type
        self.json = nil
    }
    
    init(type: JumpType, data: Codable) {
        self.type = type
        self.json = toJson(data)
    }
    
    func getData<T: Codable>(_ json: String?,_ modeType: T.Type) -> T? {
        guard let model = try? fromJson(json, modeType) else {
            return nil
        }
        return model
    }

}
